import { userListApi } from "@/api/user.js"
export default {
    state: {
        userListDatas: {}
    },
    mutations: {
        changeUserListDatas(state, data) {
            state.userListDatas = data
        }
    },
    actions: {
        async actChangeUserListDatas(context, data) {
            let result = await userListApi(data)
            console.log(result.data.data);
            result.data.data.forEach(item => {
                switch (item.level) {
                    case "1":
                        item.level = "管理员";
                        break;
                    case "2":
                        item.level = "青铜用户";
                        break;
                    case "3":
                        item.level = "白银用户";
                        break;
                    case "4":
                        item.level = "黄金用户";
                        break;
                }
            })

            context.commit("changeUserListDatas", result.data)
        }
    }
}